<template>
  <div class="app-container">
    <el-form ref="elForm" :disabled="$route.query.isInfo" :model="formData" :rules="rules" size="medium"
      label-width="120px">
      <h2 style="text-align: center">人员档案</h2>
      <h4 class="form-header h4">基本信息</h4>
      <el-row :gutter="15">
        <el-col :span="8">
          <el-form-item label="手机号" prop="phone">
            <el-input v-model="formData.phone" placeholder="手机号作为登录账号" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="姓名" prop="nickName">
            <el-input v-model="formData.nickName" maxlength="5" placeholder="请输入姓名 长度最大5" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="性别" prop="sex">
            <el-select v-model="formData.sex" placeholder="请选择性别" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="身体状况" prop="healthValue">
            <el-select v-model="formData.healthValue" placeholder="请选择身体状况" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_user_health" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="身份证号码" prop="idNum">
            <el-input @blur="blurIdNum" v-model="formData.idNum" placeholder="请输入身份证号码" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="出生日期" prop="birthDate">
            <el-date-picker v-model="formData.birthDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
              :style="{ width: '100%' }" placeholder="请选择出生日期" clearable></el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="政治面貌" prop="politicalStatusValue">
            <el-select v-model="formData.politicalStatusValue" placeholder="请选择政治面貌" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_docbase_political" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8">
          <el-form-item label="婚姻状况" prop="maritalStatusValue">
            <el-select v-model="formData.maritalStatusValue" placeholder="请选择婚姻状况" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_docbase_marital" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col> -->
        <el-col :span="8">
          <el-form-item label="国籍" prop="nationality">
            <el-input v-model="formData.nationality" placeholder="请输入国籍" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="籍贯" prop="nativePlace">
            <el-input v-model="formData.nativePlace" placeholder="请输入籍贯" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="家庭住址" prop="homeAddress">
            <el-input v-model="formData.homeAddress" placeholder="请输入家庭住址" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="现居住地址" prop="nowAddress">
            <el-input v-model="formData.nowAddress" placeholder="请输入现居住地址" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="电子邮箱" prop="email">
            <el-input v-model="formData.email" placeholder="请输入电子邮箱" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="紧急联系人" prop="emergencyContact">
            <el-input v-model="formData.emergencyContact" placeholder="请输入紧急联系人" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="紧急联系人电话" prop="emergencyPhone">
            <el-input v-model="formData.emergencyPhone" placeholder="请输入紧急联系人电话" clearable maxlength="11"
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="现聘用单位" prop="nowCompany">
            <el-input v-model="formData.nowCompany" placeholder="请输入现聘用单位" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <div style="width: 100%; display: flex; flex: 1;">
          <el-col :span="8">
            <el-form-item label="现聘用单位关系" prop="nowCompanyRelationship">
              <el-select multiple v-model="formData.nowCompanyRelationship" placeholder="请选择现聘用单位关系" clearable
                :style="{ width: '100%' }">
                <el-option v-for="dict in dict.type.sys_compony_tie" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
        </div>

        <el-col :span="8">
          <el-form-item label="证件照" prop="photo">
            <imageUpload :limit="1" :disabled="$route.query.isInfo" :fileType="['png', 'jpg', 'jpeg', 'PDF', 'pdf']"
              v-model="formData.photo" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="身份证正面" prop="idCardFace">
            <imageUploadCard :limit="1" :disabled="$route.query.isInfo" :fileType="['png', 'jpg', 'jpeg', 'PDF', 'pdf']"
              v-model="formData.idCardFace" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="身份证反面" prop="idCardReverse">
            <imageUploadCard :limit="1" :disabled="$route.query.isInfo" :fileType="['png', 'jpg', 'jpeg', 'PDF', 'pdf']"
              v-model="formData.idCardReverse" />
          </el-form-item>
        </el-col>
      </el-row>
      <h4 class="form-header h4">
        职称
        <el-button type="primary" plain size="mini" @click="handleAdduserDoc">增行</el-button>
        <!-- <el-button type="danger" plain size="mini" @click="handleDeleuserDoc">删行</el-button> -->
      </h4>
      <el-table :data="formData.userDocProfessional" :border="true" style="width: 100%">
        <el-table-column label="序号" type="index" align="center" />

        <el-table-column label="职称" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`userDocProfessional.${scope.$index}.professionalValue`"
              :rules="rules.userDocProfessional.professionalValue">
              <el-select v-model="scope.row.professionalValue" placeholder="请选择职称" clearable :style="{ width: '100%' }"
                @change="changeTitle">
                <el-option v-for="dict in dict.type.sys_docbase_professional" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="获取时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`userDocProfessional.${scope.$index}.getDate`"
              :rules="rules.userDocProfessional.getDate">
              <el-date-picker v-model="scope.row.getDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择获取时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="专业（学科）" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`userDocProfessional.${scope.$index}.subjectName`"
              :rules="rules.userDocProfessional.subjectName">
              <el-input v-model="scope.row.subjectName" placeholder="请输入专业（学科）"></el-input>
              <!-- <el-select
                v-model="scope.row.subjectName"
                placeholder="请选择专业（学科）"
                clearable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="dict in dict.type.sys_docbase_subject_alue"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>-->
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="职称系列" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`userDocProfessional.${scope.$index}.series`"
              :rules="rules.userDocProfessional.series">
              <el-input v-model="scope.row.series" placeholder="请输入职称系列"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="200" label="附件" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`userDocProfessional.${scope.$index}.professionalUrl`"
              :rules="rules.userDocProfessional.professionalUrl">
              <FileUpload v-model="scope.row.professionalUrl"></FileUpload>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="删除" align="center">
          <template slot-scope="scope">
            <el-button type="danger" plain size="mini" @click="handleDeleuserDoc(scope.$index)">删行</el-button>
          </template>
        </el-table-column>

      </el-table>

      <h4 class="form-header h4">入职信息</h4>
      <el-row :gutter="15">
        <el-col :span="8">
          <el-form-item label="入职时间" prop="join.startDate">
            <el-date-picker v-model="formData.join.startDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
              :style="{ width: '100%' }" placeholder="请选择入职时间" clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="转正日期" prop="join.toOfficialDate">
            <el-date-picker v-model="formData.join.toOfficialDate" format="yyyy-MM-dd" disabled value-format="yyyy-MM-dd"
              :style="{ width: '100%' }" placeholder="请选择转正日期" clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="离职日期" prop="join.leaveDate">
            <el-date-picker disabled v-model="formData.join.leaveDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
              :style="{ width: '100%' }" placeholder="请选择离职日期" clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="部门" prop="join.deptId">
            <el-cascader :props="{ value: 'id', checkStrictly: true }" :show-all-levels="false" ref="reference"
              :style="{ width: '100%' }" placeholder="请选择部门" v-model="formData.join.deptId"
              :options="deptOptions"></el-cascader>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8">
          <el-form-item label="岗位" prop="join.postIds">
            <el-select
              v-model="formData.join.postIds"
              placeholder="请选择岗位"
              clearable
              multiple
              :style="{ width: '100%' }"
            >
              <el-option
                v-for="dict in dict.type.sys_user_post_type"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>-->
        <el-col :span="8">
          <el-form-item label="岗位" prop="join.roleId">
            <el-select multiple v-model="formData.join.roleId" placeholder="请选择岗位" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_user_post_type" :key="dict.value" :label="dict.label"
                :value="dict.value.toString()" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="开户行" prop="join.bankValue">
            <el-select v-model="formData.join.bankValue" placeholder="请选择开户行" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_user_bank" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="银行卡号" prop="join.bankAccount">
            <el-input v-model="formData.join.bankAccount" placeholder="请输入银行卡号" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="公积金账户" prop="join.accumulation">
            <el-input v-model="formData.join.accumulation" placeholder="请输入公积金账户" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="社保号" prop="join.social">
            <el-input v-model="formData.join.social" placeholder="请输入社保号" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="人员状态" prop="join.userTypeValue">
            <el-select v-model="formData.join.userTypeValue" placeholder="请选择人员状态" clearable :style="{ width: '100%' }">
              <el-option v-for="dict in dict.type.sys_docbase_user_type" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="医保号" prop="join.medicalCode">
            <el-input v-model="formData.join.medicalCode" placeholder="请输入医保号" clearable
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <h4 class="form-header h4">
        教育经历
        <el-button type="primary" plain size="mini" @click="handleAdd">增行</el-button>
        <!-- <el-button type="danger" plain size="mini" @click="handleDele">删行</el-button> -->
      </h4>
      <el-table :data="formData.education" :border="true" style="width: 100%">
        <el-table-column label="序号" type="index" align="center" />
        <el-table-column label="开始时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.startDate`"
              :rules="rules.education.startDate">
              <el-date-picker v-model="scope.row.startDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择开始时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="结束时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.endDate`" :rules="rules.education.endDate">
              <el-date-picker v-model="scope.row.endDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择结束时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="毕业院校" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.schoolName`"
              :rules="rules.education.schoolName">
              <el-input v-model="scope.row.schoolName" placeholder="请输入毕业院校"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="专业" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.speciality`"
              :rules="rules.education.speciality">
              <el-input v-model="scope.row.speciality" placeholder="请输入专业"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="学历" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.recordValue`"
              :rules="rules.education.recordValue">
              <el-select v-model="scope.row.recordValue" placeholder="请选择学历" clearable :style="{ width: '100%' }">
                <el-option v-for="dict in dict.type.sys_education" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="200" label="附件" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`education.${scope.$index}.educationUrl`"
              :rules="rules.education.educationUrl">
              <FileUpload v-model="scope.row.educationUrl"></FileUpload>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column  label="删除" align="center">
          <template slot-scope="scope">
            <el-button type="danger" plain size="mini" @click="handleDele(scope.$index)">删行</el-button>
          </template>
        </el-table-column>

        <!-- <el-table-column label="毕业日期" align="center">
          <template slot-scope="scope">
            <el-form-item
              label-width="0"
              :prop="`education.${scope.$index}.graduateDate`"
              :rules="rules.education.graduateDate"
            >
              <el-date-picker
                v-model="scope.row.graduateDate"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                :style="{ width: '100%' }"
                placeholder="请选择毕业日期"
                clearable
              ></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>-->
      </el-table>
      <h4 class="form-header h4" v-if="!$route.query.isInfo || formData.work.length > 0">
        工作经历
        <el-button type="primary" plain size="mini" @click="handleAddwork">增行</el-button>
        <!-- <el-button type="danger" plain size="mini" @click="handleDelework">删行</el-button> -->
      </h4>
      <el-table v-if="!$route.query.isInfo || formData.work.length > 0" :data="formData.work" :border="true"
        style="width: 100%">
        <el-table-column label="序号" type="index" align="center" />
        <el-table-column label="开始时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.startDate`">
              <el-date-picker v-model="scope.row.startDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择开始时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="结束时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.endDate`">
              <el-date-picker v-model="scope.row.endDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择结束时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="公司名称" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.company`">
              <el-input v-model="scope.row.company" placeholder="请输入公司名称"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="岗位" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.dept`">
              <el-input v-model="scope.row.dept" placeholder="请输入岗位"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="工作内容" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.content`">
              <el-input v-model="scope.row.content" placeholder="请输入工作内容"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="离职原因" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.leaveReason`">
              <el-input v-model="scope.row.leaveReason" placeholder="请输入离职原因"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
       
        <el-table-column label="删除" align="center">
          <template slot-scope="scope">
            <el-button type="danger" plain size="mini" @click="handleDelework(scope.$index)">删行</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--  个人继续教育 -->
      <h4 class="form-header h4" v-if="!$route.query.isInfo || formData.educationVos.length > 0">
        个人继续教育
        <el-button type="primary" plain size="mini" @click="handleAddEducationVos">增行</el-button>
        <!-- <el-button type="danger" plain size="mini" @click="handleDeleEducationVos">删行</el-button> -->
      </h4>
      <el-table v-if="!$route.query.isInfo || formData.educationVos.length > 0" :data="formData.educationVos"
        :border="true" style="width: 100%">
        <el-table-column label="序号" type="index" align="center" />
        <el-table-column label="培训时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.educationTime`">
              <el-date-picker v-model="scope.row.educationTime" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择开始时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <!-- <el-table-column label="结束时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.endDate`" :rules="rules.work.endDate">
              <el-date-picker v-model="scope.row.endDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择结束时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>-->
        <el-table-column label="主办单位" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.organization`">
              <el-input v-model="scope.row.organization" placeholder="请输入主办单位"></el-input>
            </el-form-item>
          </template>
        </el-table-column>

        <el-table-column label="培训内容" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.content`">
              <el-input v-model="scope.row.content" placeholder="请输入培训内容"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="培训结构" align="center">
          <el-table-column prop="name" label="证件编号" width="120">
            <template slot-scope="scope">
              <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.certCode`">
                <el-input v-model="scope.row.certCode" placeholder="请输入证件编号"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="name" label="其他" width="120">
            <template slot-scope="scope">
              <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.otherInfo`">
                <el-input v-model="scope.row.otherInfo" placeholder="请输入其他"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="备注" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.remark`">
              <el-input v-model="scope.row.remark" placeholder="请输入备注"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="证书类别" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.certTypeValue`">
              <el-select v-model="scope.row.certTypeValue" placeholder="请选择证书类别" clearable :style="{ width: '100%' }">
                <el-option v-for="dict in dict.type.sys_doc_type" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="200" label="附件" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`educationVos.${scope.$index}.certUrl`">
              <FileUpload v-model="scope.row.certUrl"></FileUpload>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column  label="删除" align="center">
          <template slot-scope="scope">
            <el-button type="danger" plain size="mini" @click="handleDeleEducationVos(scope.$index)">删行</el-button>

          </template>
        </el-table-column>

      </el-table>
      <!-- 个人继续教育end -->
      <!--  个人获奖证书汇总表 -->
      <h4 class="form-header h4" v-if="!$route.query.isInfo || formData.rewards.length > 0">
        个人获奖证书汇总表
        <el-button type="primary" plain size="mini" @click="handleAddRewards">增行</el-button>
        <!-- <el-button type="danger" plain size="mini" @click="handleDeleRewards">删行</el-button> -->
      </h4>
      <el-table v-if="!$route.query.isInfo || formData.rewards.length > 0" :data="formData.rewards" :border="true"
        style="width: 100%">
        <el-table-column label="序号" type="index" align="center" />
        <el-table-column label="获奖时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.rewardTime`">
              <el-date-picker v-model="scope.row.rewardTime" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择获奖时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>
        <!-- <el-table-column label="结束时间" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`work.${scope.$index}.endDate`" :rules="rules.work.endDate">
              <el-date-picker v-model="scope.row.endDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择结束时间" clearable></el-date-picker>
            </el-form-item>
          </template>
        </el-table-column>-->
        <el-table-column label="组织方" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.organization`">
              <el-input v-model="scope.row.organization" placeholder="请输入组织方"></el-input>
            </el-form-item>
          </template>
        </el-table-column>

        <el-table-column label="奖项等级" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.rewardLevel`">
              <el-input v-model="scope.row.rewardLevel" placeholder="请输入奖项等级"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="奖项类别" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.rewardType`">
              <el-input v-model="scope.row.rewardType" placeholder="请输入奖项类别"></el-input>
            </el-form-item>
          </template>
        </el-table-column>

        <el-table-column label="奖项介绍" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.rewardContent`">
              <el-input v-model="scope.row.rewardContent" placeholder="请输入奖项介绍"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="200" label="附件" align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0" :prop="`rewards.${scope.$index}.rewardUrl`">
              <FileUpload v-model="scope.row.rewardUrl"></FileUpload>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column  label="删除" align="center">
          <template slot-scope="scope">
           <el-button type="danger" plain size="mini" @click="handleDeleRewards(scope.$index)">删行</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 个人获奖证书汇总表end -->
      <el-col :span="24">
        <el-form-item label-width="0" style="text-align: center; margin-top: 30px">
          <el-button v-if="!$route.query.isInfo && this.formData.draft != 1" type="primary"
            @click="submitForm(0)">暂存</el-button>
          <el-button v-if="!$route.query.isInfo" type="primary" @click="submitForm(1)">提交</el-button>
          <el-button :disabled="false" @click="resetForm">返回</el-button>
          <el-button :disabled="false" type="primary" v-if="formData.isSure == 0 && $route.query.isInfo && formData.isShow
            " @click="docBaseSure">确认信息</el-button>
          <el-button :disabled="false" type="primary" v-hasPermi="['personnel:file:indexUser:account']"
            v-if="formData.hasAccount == 0 && $route.query.isInfo && $route.query.selfFlag != 0"
            @click="handleAccount">创建账号</el-button>
        </el-form-item>
      </el-col>
    </el-form>
  </div>
</template>

<script>
import {
  docBaseAdd,
  updateDocBase,
  docBaseSure,
  docBaseInfo
} from "@/api/finance/personnel/file.js";

import { deptTreeSelect, getLeader } from "@/api/system/user.js";
import { optionselectPost } from "@/api/system/post.js";
import { optionselect } from "@/api/system/role.js";
import store from "@/store";
import { IdCard } from "@/utils/ruoyi.js";
export default {
  dicts: [
    "sys_user_sex",
    "sys_docbase_political",
    "sys_docbase_marital",
    "sys_docbase_professional",
    "sys_docbase_user_type",
    "sys_user_health",
    "sys_compony_tie",
    "sys_user_bank",
    "sys_education",
    "sys_user_post_type",
    'sys_doc_type'
  ],

  components: {},
  props: [],
  data() {
    return {
      formData: {
        education: [
          {
            startDate: null,
            endDate: null,
            schoolName: null,
            speciality: null,
            recordValue: null,
            graduateDate: null,
            educationUrl: ""
          }
        ],
        work: [
          {
            startDate: null,
            endDate: null,
            company: undefined,
            dept: undefined,
            content: undefined,
            leaveReason: undefined
          }
        ],
        educationVos: [
          {
            educationTime: null,
            organization: undefined,
            content: undefined,
            certCode: undefined,
            otherInfo: undefined,
            remark: undefined,
            certTypeValue: undefined,
            certTypeLabel: undefined
          }
        ],
        rewards: [
          {
            rewardTime: null,
            organization: undefined,
            rewardContent: undefined,
            rewardType: undefined,
            rewardLevel: undefined,
            rewardUrl: ''
          }
        ],
        userDocProfessional: [
          {
            professionalValue: null,
            professionalLabel: null,
            getDate: null,
            subjectName: null,
            subjectName: null,
            series: null,
            professionalUrl: ''
          }
        ],
        phone: undefined,
        nowAddress: undefined,
        healthValue: undefined,
        nickName: undefined,
        nowCompany: undefined,
        nowCompanyRelationship: [],
        sex: undefined,
        birthDate: null,
        idNum: undefined,
        politicalStatusValue: undefined,
        maritalStatusValue: undefined,
        nationality: undefined,
        nativePlace: undefined,
        homeAddress: undefined,
        email: undefined,
        phonenumber: undefined,
        school: undefined,
        specialize: undefined,
        degree: undefined,
        graduationDate: null,
        emergencyContact: undefined,
        emergencyPhone: undefined,
        photo: undefined,
        idCardFace: undefined,
        idCardReverse: undefined,
        join: {
          startDate: null,
          toOfficialDate: null,
          leaveDate: null,
          deptId: undefined,
          postIds: [],
          roleId: [],
          bankAccount: undefined,
          accumulation: undefined,
          social: undefined,
          professionalValue: undefined,
          userTypeValue: undefined,
          medicalCode: undefined,
          bankValue: undefined
        }
      },
      rules: {
        userDocProfessional: {
          professionalValue: [
            {
              required: true,
              message: "请选择职称",
              trigger: "change"
            }
          ],
          subjectName: [
            {
              required: true,
              message: "请输入专业（学科）",
              trigger: "blue"
            }
          ],
          series: [
            {
              required: true,
              message: "请输入职称系列",
              trigger: "blur"
            }
          ],
          professionalUrl: [
            {
              required: false,
              message: "请上传附件",
              trigger: "blur"
            }
          ],
          getDate: [
            {
              required: true,
              message: "请选择时间",
              trigger: "change"
            }
          ]
        },

        education: {
          startDate: [
            {
              required: true,
              message: "请选择开始时间",
              trigger: "change"
            }
          ],
          endDate: [
            {
              required: true,
              message: "请选择结束时间",
              trigger: "change"
            }
          ],
          schoolName: [
            {
              required: true,
              message: "请输入毕业院校",
              trigger: "blur"
            }
          ],
          speciality: [
            {
              required: true,
              message: "请输入专业",
              trigger: "blur"
            }
          ],
          recordValue: [
            {
              required: true,
              message: "请选择学历",
              trigger: "change"
            }
          ],
          educationUrl: [
            {
              required: false,
              message: "请上传附件",
              trigger: "change"
            }
          ],
          graduateDate: [
            // {
            //   required: true,
            //   message: "请选择毕业日期",
            //   trigger: "change",
            // },
          ]
        },
        // work: {
        //   startDate: [
        //     {
        //       required: true,
        //       message: "请选择开始时间",
        //       trigger: "change"
        //     }
        //   ],
        //   endDate: [
        //     {
        //       required: false,
        //       message: "请选择结束时间",
        //       trigger: "change"
        //     }
        //   ],
        //   company: [
        //     {
        //       required: true,
        //       message: "请输入工作单位",
        //       trigger: "blur"
        //     }
        //   ],
        //   dept: [
        //     {
        //       required: true,
        //       message: "请输入岗位",
        //       trigger: "blur"
        //     }
        //   ],
        //   content: [
        //     {
        //       required: true,
        //       message: "请输入工作内容",
        //       trigger: "blur"
        //     }
        //   ],
        //   leaveReason: [
        //     {
        //       required: false,
        //       message: "请输入离职原因",
        //       trigger: "blur"
        //     }
        //   ]
        // },
        // educationVos: {
        //   educationTime: [
        //     {
        //       required: true,
        //       message: "请选择培训时间",
        //       trigger: "change"
        //     }
        //   ],
        //   organization: [
        //     {
        //       required: true,
        //       message: "请输入培训单位",
        //       trigger: "blur"
        //     }
        //   ],
        //   otherInfo: [
        //     {
        //       required: true,
        //       message: "请输入其他",
        //       trigger: "blur"
        //     }
        //   ],
        //   content: [
        //     {
        //       required: true,
        //       message: "请输入培训内容",
        //       trigger: "blur"
        //     }
        //   ],
        //   certCode: [
        //     {
        //       required: true,
        //       message: "请输入证书编号",
        //       trigger: "blur"
        //     }
        //   ]
        // },
        // rewards: {
        //   rewardTime: [
        //     {
        //       required: true,
        //       message: "请选择培训时间",
        //       trigger: "change"
        //     }
        //   ],
        //   organization: [
        //     {
        //       required: true,
        //       message: "请输入组织方",
        //       trigger: "blur"
        //     }
        //   ],
        //   rewardLevel: [
        //     {
        //       required: true,
        //       message: "请输入获奖等级",
        //       trigger: "blur"
        //     }
        //   ],
        //   rewardContent: [
        //     {
        //       required: true,
        //       message: "请输入获奖内容",
        //       trigger: "blur"
        //     }
        //   ],
        //   rewardType: [
        //     {
        //       required: true,
        //       message: "请输入获奖类别",
        //       trigger: "blur"
        //     }
        //   ]
        // },
        join: {
          bankValue: [
            {
              required: false,
              message: "请选择开户行",
              trigger: "change"
            }
          ],
          startDate: [
            {
              required: true,
              message: "请选择入职时间",
              trigger: "change"
            }
          ],
          toOfficialDate: [
            {
              required: false,
              message: "请选择转正日期",
              trigger: "change"
            }
          ],
          leaveDate: [
            {
              required: false,
              message: "请选择离职日期",
              trigger: "change"
            }
          ],
          deptId: [
            {
              required: true,
              message: "请选择部门",
              trigger: "change"
            }
          ],
          postIds: [
            {
              required: false,
              message: "请选择岗位",
              trigger: "change"
            }
          ],
          roleId: [
            {
              required: true,
              message: "请选择角色",
              trigger: "change"
            }
          ],

          bankAccount: [
            {
              required: false,
              message: "请输入银行卡号",
              trigger: "blur"
            }
          ],
          accumulation: [
            {
              required: false,
              message: "请输入公积金账户",
              trigger: "blur"
            }
          ],
          social: [
            {
              required: false,
              message: "请输入社保号",
              trigger: "blur"
            }
          ],

          userTypeValue: [
            {
              required: true,
              message: "请选择人员状态",
              trigger: "change"
            }
          ],
          medicalCode: [
            {
              required: false,
              message: "请输入医保号",
              trigger: "blur"
            }
          ]
        },

        photo: [
          {
            required: true,
            message: "证件照不能为空",
            trigger: "change"
          }
        ],
        idCardFace: [
          {
            required: true,
            message: "身份证正面不能为空",
            trigger: "change"
          }
        ],
        idCardReverse: [
          {
            required: true,
            message: "身份证反面不能为空",
            trigger: "change"
          }
        ],
        phone: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "手机号格式错误"
          },
          {
            required: true,
            message: "手机号作为登录账号",
            trigger: "blur"
          }
        ],
        nickName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "blur"
          }
        ],
        nowCompany: [
          {
            required: true,
            message: "请输入现聘用单位",
            trigger: "blur"
          }
        ],
        nowAddress: [
          {
            required: true,
            message: "请输入现居住地址",
            trigger: "blur"
          }
        ],
        healthValue: [
          {
            required: true,
            message: "请选择身体状况",
            trigger: "change"
          }
        ],
        nowCompanyRelationship: [
          {
            required: true,
            message: "请选择现聘用单位关系",
            trigger: "change"
          }
        ],
        sex: [
          {
            required: true,
            message: "请选择性别",
            trigger: "change"
          }
        ],
        birthDate: [
          {
            required: true,
            message: "请选择出生日期",
            trigger: "change"
          }
        ],
        idNum: [
          {
            pattern: /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
            message: "请输入正确的身份证号码"
          },
          {
            required: true,
            message: "请输入身份证号码",
            trigger: "blur"
          }
        ],
        politicalStatusValue: [
          {
            required: true,
            message: "请选择政治面貌",
            trigger: "change"
          }
        ],
        // maritalStatusValue: [
        //   {
        //     required: true,
        //     message: "请选择婚姻状况",
        //     trigger: "change"
        //   }
        // ],
        nationality: [
          {
            required: true,
            message: "请输入国籍",
            trigger: "blur"
          }
        ],
        nativePlace: [
          {
            required: true,
            message: "请输入籍贯",
            trigger: "blur"
          }
        ],
        homeAddress: [
          {
            required: true,
            message: "请输入家庭住址",
            trigger: "blur"
          }
        ],
        email: [
          {
            pattern: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
            message: "请输入正确的电子邮箱"
          },
          {
            required: true,
            message: "请输入电子邮箱",
            trigger: "blur"
          }
        ],
        phonenumber: [
          {
            required: true,
            message: "请输入联系电话",
            trigger: "blur"
          }
        ],
        emergencyContact: [
          {
            required: true,
            message: "请输入紧急联系人",
            trigger: "blur"
          }
        ],
        emergencyPhone: [
          {
            required: true,
            message: "请输入紧急联系人电话",
            trigger: "blur"
          }
        ]
      },
      deptOptions: [],
      postOptions: [],
      roleOptions: []
    };
  },
  computed: {},
  watch: {
    "formData.join.postIds": {
      handler(val) {
        if (this.formData.join.deptId) {
          this.getLeader(this.formData.join.deptId, val);
        }
      },
      immediate: true
    }
  },
  created() {
    this.optionselectPost();
    this.optionselectRole();

    this.getDeptTree();
    if (this.$route.query.isEdit || this.$route.query.isInfo) {
      this.getinfo();
    }
  },
  mounted() { },
  methods: {
    blurIdNum(i) {
      let reg = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/;
      if (reg.test(this.formData.idNum)) {
        this.formData.birthDate = IdCard(this.formData.idNum);
      }
    },
    optionselectPost() {
      optionselectPost().then(response => {
        this.postOptions = response.data;
      });
    },
    optionselectRole() {
      optionselect().then(response => {
        this.roleOptions = response.data;
      });
    },
    changeTitle(e) {
      console.log(e);
      if (e == "7") {
        this.rules.userDocProfessional.series[0].required = false;
        this.rules.userDocProfessional.subjectName[0].required = false;
        this.rules.userDocProfessional.getDate[0].required = false;
      }
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then(response => {
        this.deptOptions = response.data;
      });
    },
    changeUser(e) {
      this.formData.join.leaderName = e.nickName;
    },
    docBaseSure() {
      docBaseSure(this.formData.userDocBaseId).then(response => {
        this.$message.success("确认成功");
        this.getinfo();
      });
    },
    getinfo() {
      docBaseInfo(this.$route.query.id).then(response => {
        this.formData = response.data;

        console.log(response.data.join.roleId, "response.data.join.roleId");
        console.log(this.formData.nowCompanyRelationship.split(","), "this.formData");
        this.formData.join.roleId =
          this.formData.join.roleId != ""
            ? response.data.join.roleId.split(",").map(e => e)
            : null;
        this.formData.nowCompanyRelationship = this.formData.nowCompanyRelationship.split(",")
        this.formData.join.postIds = response.data.join.postIds ? response.data.join.postIds.split(",") : [].map(e => Number(e));
        // this.formData.join.roleId = this.formData.join.roleId?this.formData.join.roleId:null
      });
    },
    handleAdd() {
      this.formData.education.push({
        startDate: null,
        endDate: null,
        schoolName: null,
        speciality: null,
        recordValue: null,
        graduateDate: null
      });
    },
    handleAdduserDoc() {
      this.formData.userDocProfessional.push({
        professionalValue: null,
        professionalLabel: null,
        getDate: null,
        subjectName: null,
        subjectName: null,
        series: null
      });
    },
    handleDeleuserDoc(e) {
      if (this.formData.userDocProfessional.length == 1) return;
      // this.formData.userDocProfessional.pop();
      this.formData.userDocProfessional.splice(e,1);

    },
    handleDele(e) {
      if (this.formData.education.length == 1) return;
      this.formData.education.splice(e,1);

      // this.formData.education.pop();
    },
    handleAddwork() {
      this.formData.work.push({
        startDate: null,
        endDate: null,
        company: undefined,
        dept: undefined,
        content: undefined,
        leaveReason: undefined
      });
    },
    handleDelework(e) {
      if (this.formData.work.length == 1) return;
      this.formData.work.splice(e,1)
      // this.formData.work.pop();
    },
    handleAddRewards() {
      this.formData.rewards.push({
        rewardTime: null,
        organization: undefined,
        rewardContent: undefined,
        rewardType: undefined,
        rewardLevel: undefined
      });
    },
    handleDeleRewards(e) {
      console.log(e);
      if (this.formData.rewards.length == 1) return;
      this.formData.rewards.splice(e,1)
      // this.formData.rewards.pop();
    },
    handleAddEducationVos() {
      this.formData.educationVos.push({
        educationTime: null,
        organization: undefined,
        content: undefined,
        certCode: undefined,
        otherInfo: undefined,
        remark: undefined
      });
    },
    handleDeleEducationVos(e) {
      if (this.formData.educationVos.length == 1) return;
      // this.formData.educationVos.pop();
      this.formData.educationVos.splice(e,1);
    },
    submitForm(e) {
      let query = JSON.parse(JSON.stringify(this.formData));

      if (query.join.postIds) {
        let postName = this.dict.type.sys_user_post_type.filter(i =>
          query.join.postIds.includes(i.value)
        );

        query.join.postName = postName.map(e => e.label).toString();
        console.log(query.join.postName);

        query.join.postIds = query.join.postIds.toString();
      }

      let roleName = this.dict.type.sys_user_post_type.filter(i =>
        query.join.roleId.includes(i.value)
      );
      query.join.roleName = roleName.map(e => e.label).toString();
      query.join.roleId = query.join.roleId.toString();
      console.log(query.join.roleId);
      query.draft = e;
      if (e == 0) {
        console.log(this.$refs.reference);
        query.join.deptId =
          this.$refs.reference.getCheckedNodes()[0] &&
          this.$refs.reference.getCheckedNodes()[0].value;
        query.join.deptName =
          this.$refs.reference.getCheckedNodes()[0] &&
          this.$refs.reference.getCheckedNodes()[0].label;
        console.log(this.dict.type.sys_docbase_political);
        if (query.politicalStatusValue) {
          query.politicalStatusName = this.dict.type.sys_docbase_political.find(
            i => i.value == query.politicalStatusValue
          ).label;
        }
        // if (query.maritalStatusValue) {
        //   query.maritalStatusName = this.dict.type.sys_docbase_marital.find(
        //     i => i.value == query.maritalStatusValue
        //   ).label;
        // }
        if (query.join.userTypeValue) {
          query.join.userTypeLabel = this.dict.type.sys_docbase_user_type.find(
            i => i.value == query.join.userTypeValue
          ).label;
        }
        if (query.join.bankValue) {
          query.join.bankName =
            query.join.bankValue &&
            this.dict.type.sys_user_bank.find(
              i => i.value == query.join.bankValue
            ).label;
        }
        if (query.healthValue) {
          query.healthName = this.dict.type.sys_user_health.find(
            i => i.value == query.healthValue
          ).label;
        }
        query.nowCompanyRelationship = query.nowCompanyRelationship.toString();
        if (query.education > 0) {
          query.education.forEach(e => {
            if (e.recordValue) {
              e.recordName = this.dict.type.sys_education.find(
                i => i.value == e.recordValue
              ).label;
            }

          });
        }
        if (query.userDocProfessional > 0) {
          query.userDocProfessional.forEach((e, i) => {
            console.log(e);

            e.professionalLabel = this.dict.type.sys_docbase_professional.find(
              i => i.value == e.professionalValue
            ).label;
            // e.subjectName = this.dict.type.sys_docbase_subject_alue.find(
            //   (i) => i.value == e.subjectName
            // ).label;
          });
        }
        if (query.educationVos.length > 0) {
          console.log(query.educationVos, 'query.educationVos');
          query.educationVos.forEach((e) => {
            console.log(e.certTypeValue,'e.certTypeValue');
            if(e.certTypeValue){
              e.certTypeLabel = this.dict.type.sys_doc_type.find(
              i => i.value == e.certTypeValue
            ).label;
            }
           

          });
        }
        if (this.formData.userDocBaseId != undefined) {
          updateDocBase(query).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.resetForm();
          });
        } else {
          docBaseAdd(query).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.resetForm();
          });
        }
      } else {
        if (query.userDocProfessional.length > 0) {
          console.log(query.userDocProfessional, 'query.userDocProfessional');
          query.userDocProfessional.forEach((e, i) => {
            if (e.professionalValue == "7") {
              this.rules.userDocProfessional.series[i].required = false;
              this.rules.userDocProfessional.subjectName[i].required = false;
              this.rules.userDocProfessional.getDate[i].required = false;
            }
            console.log(this.dict.type.sys_docbase_professional, 'this.dict.type.sys_docbase_professional');
            e.professionalLabel = this.dict.type.sys_docbase_professional.find(
              i => i.value == e.professionalValue
            ).label;
            console.log(e.professionalLabel);
            // e.subjectName = this.dict.type.sys_docbase_subject_alue.find(
            //   (i) => i.value == e.subjectName
            // ).label;
          });
        }
        if (query.educationVos.length > 0) {
          console.log(query.educationVos, 'query.educationVos');
          if(e.certTypeValue){
            query.educationVos.forEach((e) => {
            e.certTypeLabel = this.dict.type.sys_doc_type.find(
              i => i.value == e.certTypeValue
            ).label;
          });
          }
         
        }
        this.$refs["elForm"].validate(valid => {
          if (valid) {
            query.join.deptId = this.$refs.reference.getCheckedNodes()[0].value;
            query.join.deptName = this.$refs.reference.getCheckedNodes()[0].label;

            query.politicalStatusName = this.dict.type.sys_docbase_political.find(
              i => i.value == query.politicalStatusValue
            ).label;
            // query.maritalStatusName = this.dict.type.sys_docbase_marital.find(
            //   i => i.value == query.maritalStatusValue
            // ).label;

            query.join.userTypeLabel = this.dict.type.sys_docbase_user_type.find(
              i => i.value == query.join.userTypeValue
            ).label;
            query.join.bankName =
              query.join.bankValue &&
              this.dict.type.sys_user_bank.find(
                i => i.value == query.join.bankValue
              ).label;

            query.healthName = this.dict.type.sys_user_health.find(
              i => i.value == query.healthValue
            ).label;
            query.nowCompanyRelationship = query.nowCompanyRelationship.toString();
            query.education.forEach(e => {
              if (e.recordValue) {
                e.recordName = this.dict.type.sys_education.find(
                  i => i.value == e.recordValue
                ).label;
              }

            });

            if (this.formData.userDocBaseId != undefined) {
              updateDocBase(query).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.resetForm();
              });
            } else {
              docBaseAdd(query).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.resetForm();
              });
            }
          }
        });
      }
    },
    resetForm() {
      this.$tab.closeOpenPage();
    },
    handleAccount() {
      this.$router.push("/system/user?info=" + JSON.stringify(this.formData));
    }
  }
};
</script>
